﻿-- =============================================
-- System Name:    Pre-Contract
-- Component:      Create view named vw_FeedbackInfo
-- Created By:     Leo Ren (leoren@wicresoft.com)
-- Created Date:   2011-6-7
-- =============================================
/****** Object:  View [dbo].[vw_FeedbackInfo]    Script Date: 06/22/2011 16:11:55 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_FeedbackInfo]'))
DROP VIEW [dbo].[vw_FeedbackInfo]
GO
/****** Object:  View [dbo].[vw_FeedbackInfo]    Script Date: 06/22/2011 16:11:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[vw_FeedbackInfo]'))
EXEC dbo.sp_executesql @statement = N'CREATE VIEW [dbo].[vw_FeedbackInfo]
AS
SELECT     s.ID, s.PreContractID, d1.DicItemValue AS SignType, d2.DicItemValue AS TreatmentWay, s.OperationDate, d3.DicItemValue AS InvoiceStatus, 
                      d4.DicItemValue AS CancelProcess, d5.DicItemValue AS ProblemLV1, d6.DicItemValue AS ProblemLV2, d7.DicItemValue AS DashboardIssueType, s.PeopleInCharge, 
                      s.Comments, e.EmployeeID, e.CName, e.EName, s.CreateTime
FROM         dbo.SalesFeedback AS s LEFT OUTER JOIN
                      dbo.DicItem AS d1 ON d1.DicItemID = s.SignType LEFT OUTER JOIN
                      dbo.DicItem AS d2 ON d2.DicItemID = s.TreatmentWay LEFT OUTER JOIN
                      dbo.DicItem AS d3 ON d3.DicItemID = s.InvoiceStatus LEFT OUTER JOIN
                      dbo.DicItem AS d4 ON d4.DicItemID = s.CancelProcess LEFT OUTER JOIN
                      dbo.DicItem AS d5 ON d5.DicItemID = s.ProblemLV1 LEFT OUTER JOIN
                      dbo.DicItem AS d6 ON d6.DicItemID = s.ProblemLV2 LEFT OUTER JOIN
                      dbo.DicItem AS d7 ON d7.DicItemID = s.DashboardIssueType LEFT OUTER JOIN
                      dbo.Employee AS e ON e.EmployeeID = s.Creator
'
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_DiagramPane1' , N'SCHEMA',N'dbo', N'VIEW',N'vw_FeedbackInfo', NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "s"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 125
               Right = 229
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "d1"
            Begin Extent = 
               Top = 6
               Left = 267
               Bottom = 125
               Right = 427
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "d2"
            Begin Extent = 
               Top = 6
               Left = 465
               Bottom = 125
               Right = 625
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "d3"
            Begin Extent = 
               Top = 6
               Left = 663
               Bottom = 125
               Right = 823
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "d4"
            Begin Extent = 
               Top = 6
               Left = 861
               Bottom = 125
               Right = 1021
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "d5"
            Begin Extent = 
               Top = 6
               Left = 1059
               Bottom = 125
               Right = 1219
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "d6"
            Begin Extent = 
               Top = 126
               Left = 38
               Bottom = 245
               Right = 198
            End
            DisplayFlags = 280
            TopColumn = 0
         End' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'vw_FeedbackInfo'
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_DiagramPane2' , N'SCHEMA',N'dbo', N'VIEW',N'vw_FeedbackInfo', NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'
         Begin Table = "d7"
            Begin Extent = 
               Top = 126
               Left = 236
               Bottom = 245
               Right = 396
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "e"
            Begin Extent = 
               Top = 126
               Left = 434
               Bottom = 245
               Right = 607
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'vw_FeedbackInfo'
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_DiagramPaneCount' , N'SCHEMA',N'dbo', N'VIEW',N'vw_FeedbackInfo', NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'vw_FeedbackInfo'
GO
